const app = getApp();
let that;
let calendarDate = {};
Page({
  data: {
    PageCur: 'home',
    active: 0,
    tabbar: [{
        icon: '/utils/images/home_default.svg',
        active_icon: '/utils/images/home.svg',
        name:'باشبەت',
        key: 'home'
      },
      {
        icon: '/utils/images/course_default.svg',
        active_icon: '/utils/images/course.svg',
        name:'دەرىسلىكلەر',
        key: 'course'
     
      },
      {
        icon: '/utils/images/student_default.svg',
        active_icon: '/utils/images/student.svg',
        name:'ئوقۇغۇچىلار',
        key: 'student'
      },
      {
        icon: '/utils/images/mine_default.svg',
        active_icon: '/utils/images/mine.svg',
        name:'مېنىڭ',
        key: 'me'
      }
    ],

  },

  onLoad() {
    that = this;
    that.myComponent(that.data.PageCur)
   
 
  },
  onShow() {},

  tapChange(e) {
    const key = e.currentTarget.dataset.key;
    that.setData({
      PageCur: key
    });
    that.myComponent(key)
  },
  onChange(event) {
    console.log('event.detail=====',event.detail)
    const index = event.detail;
    let key = that.data.tabbar[index].key
    console.log("key", key)
    that.setData({
        active: index,
        PageCur: key,
    });
    that.myComponent(key)
},

  myComponent(key) {
    console.log("myComponent", key)
    var tabbar = this.selectComponent("#" + key);
    tabbar.componentInnerFunction(key);
  },

  tapAction()
  {
    that.setData({
      active: 1,
      PageCur: 'course',
  });
  },
});